using System;
using System.Collections.Generic;
using System.Text;
using DAL;
using Utility;
using DTO;

namespace BUS
{
   public class tbdiadiemBUS
    {
        public static void Insert(tbdiadiem diadiem)
        {
            tbdiadiemDAL diadiemDAL = new tbdiadiemDAL();
            diadiemDAL.Insert(diadiem);

        }
        public static void Update(tbdiadiem diadiem)
        {
            tbdiadiemDAL diadiemDAL = new tbdiadiemDAL();
            diadiemDAL.Update(diadiem);
        }
        public static void Delete(int iD)
        {
            tbdiadiemDAL diadiemDAL = new tbdiadiemDAL();
            diadiemDAL.Delete(iD);
        }

        public static tbdiadiemcollection Get(string where,
        int pageindex,
        int pagesize,
        string orderby,
        string orderdirection,
        out int total)
        {
            tbdiadiemDAL diadiemDAL = new tbdiadiemDAL();
            return diadiemDAL.Get(where, pageindex, pagesize, orderby, orderdirection, out total);
        }
        public static tbdiadiemcollection GetAll()
        {
            int total = 0;
            Criteria cri = new Criteria();
            tbdiadiemDAL diadiemDAL = new tbdiadiemDAL();
            return diadiemDAL.Get(cri.Criter, 0, 0, diadiemcolumns.madiadiem.ToString(), OrderDirection.ASC.ToString(), out total);
        }
        public static tbdiadiem GetByID(int iD)
        {
            int total = 0;
            Criteria cri = new Criteria();
            cri.add(Condition.AND, diadiemcolumns.madiadiem.ToString(), Condition.EQUAL, iD);
            tbdiadiemDAL diadiemDAL = new tbdiadiemDAL();
            tbdiadiemcollection diadiemcollection = diadiemDAL.Get(cri.Criter,
                     0, 0, diadiemcolumns.madiadiem.ToString(), OrderDirection.ASC.ToString(), out total);
            if (diadiemcollection.Count > 0)
                return diadiemcollection[0];
            return null;
        }
    }
}
